//how to know if a year is leapYear
var isleapYear = (year) => {return (year % 4 === 0 && year % 100 !=0) || (year % 400) === 0}

//how much days in a specific month
var daysInMonth = (year, month) => {
  switch(month){
    case 4:
    case 6:
    case 9:
    case 11:
    return 30;
    case 2:
    return isleapYear(year) ? 29 : 28
    default:
    return 31;
  }
}

//what day is the first day of a specific month
var whatDayforFirstDay = (year, month) => {
  var day = new Date(year, month-1, 1)
  return day.getDay()  //1 mon; 0 sun;
}
